/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package scriptedsands;

import java.awt.Color;

/**
 * Parent class of all in-game particles.
 * @author Dalton
 */
public class Particle {
    private String name;
    private int id;
    private Color color;
    public int gravity;
    private float slip;
    private float density;
    private int selectable;
    public static Particle EMPTY = new Particle("Empty", Color.BLACK, 0, 0, 0, 1);
    public static Particle SAND = new Particle("Sand", Color.YELLOW, 1, 1, 2, 1);

    /**
     *
     * @param name          the name of the item/particle
     * @param color         the color of the particle
     * @param gravity       how fast it moves up or down
     * @param slip
     * @param density
     * @param selectable
     */
    public Particle(String name, Color color, int gravity, float slip, float density, int selectable){
        this.name = name;
        setId();
        this.color = color;
        this.gravity = gravity;
        this.slip = slip;
        this.density = density;
        this.selectable = selectable;
    }

    private void setId() {
        id = name.hashCode();
    }

    /**
     * Set the name of the element and set its new id.
     * @param n - name to set element to
     */

    public void setName(String n) {
        name = n;
        setId();
    }

    public Color getColor() {
        return color;
    }

}
